package com.eastmoney.emis.edda.infrastructure.constraint.repository;

import com.eastmoney.emis.edda.domain.entity.ServiceTime;
import com.eastmoney.emis.edda.domain.repository.EddaServiceTimeRepository;
import com.eastmoney.emis.edda.infrastructure.constraint.mapper.EddaTimeConstraintMapper;
import com.eastmoney.emis.edda.infrastructure.constraint.po.EddaTimeConstraintPO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @description: Description
 * @projectName: EDDA-HSBC
 * @package: com.eastmoney.emis.edda.infrastructure.constraint.repository
 * @author: 汪程程
 * @date: 2022/10/15 10:13 AM
 * @version: 1.0
 */
@Repository
public class EddaServiceTimeRepositoryImpl implements EddaServiceTimeRepository {

    @Autowired
    private EddaTimeConstraintMapper mapper;


    @Override
    public List<ServiceTime> findAllActive() {
        Integer enableStatus = 1;
        List<EddaTimeConstraintPO> eddaTimeConstraintList = mapper.findAllByStatus(enableStatus);
        return eddaTimeConstraintList.stream().map(ServiceTime::new).collect(Collectors.toList());
    }
}
